package com.itheima.reggie.controller;

import com.itheima.reggie.common.ResultInfo;
import com.itheima.reggie.domain.Setmeal;
import com.itheima.reggie.domain.SetmealDish;
import com.itheima.reggie.service.SetmealService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
public class SetmealController {

    @Autowired
    private SetmealService setmealService;
    //h5套餐展示
    @GetMapping("/setmeal/list")
    private ResultInfo setmealList(Long categoryId,Integer status){
        List<Setmeal> setmealList = setmealService.findSeatmealList(categoryId, status);
        return ResultInfo.success(setmealList);
    }
    //显示套餐内容
    @GetMapping("/setmeal/dish/{id}")
    public ResultInfo findById(@PathVariable Long id){
        List<SetmealDish> list = setmealService.findSetmealDishById(id);
        return ResultInfo.success(list);
    }
}

